package cn.kevinproject.dingtalk_robot.msg;

import com.dingtalk.api.request.OapiRobotSendRequest;
import lombok.*;

/**
 * @author kevin lau
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
public class PlainTextMessage extends AtTextMessage {

    public PlainTextMessage() {
        this.msgType = "text";
    }

    @Override
    public OapiRobotSendRequest buildRequest() {
        val request = super.buildRequest();
        val text = new OapiRobotSendRequest.Text();
        text.setContent(getText());
        request.setText(text);
        val at =  new OapiRobotSendRequest.At();
        at.setIsAtAll(getIsAttAll());
        at.setAtMobiles(getAtMobiles());
        request.setAt(at);
        return request;
    }
}
